<div id="page">
<div id="content">
		
		<!-- start latest-post -->
		
		<div id="latest-post" class="post">
			<h1 class="title">Welcome to Our Website Hotel Page!</h1>
	  		<div class="entry">
            	<form method="post" action="searchhotel.php">
				<table width="100%">
                	<tr>
                    	<td align="center"><input name="search1" type="text" size="60">&nbsp;<input name="search" type="submit" value="Search"></td>
                    </tr>
                    <tr>
                    	<td align="center">To search hotel please enter keyword...!</td> 
                    </tr>
                </table>
                </form>
			</div>


<table border="0.5" width="75%" cellpadding="0" cellspacing="0" class="sortable" align="center">
<?php
include ("include/config.php");
if (isset($_GET['page'])) { $page  = $_GET['page']; } else { $page=1; }; 
$start_from = ($page-1) * 4; 
$sql = "SELECT * FROM hotel LIMIT $start_from,4";
$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());

//print "<table border=\"1\" cellpadding=\"0\">\n";
$i=0;	

while($row=mysql_fetch_assoc($result)){
		
		if ($i%2==0)
		{ printf("<tr bgcolor=\"CCFFFF\">\n");
		}
		else
		{
		printf("<tr>\n");	}
		printf("<td rowspan=\"3\">");
		print '<img src="showhotel.php?image_id='.$row['hotelnameID'].'"/></a>'."</br>";
		printf("</td>\n");
		printf("<td>");
		print $row['hoteldescription'];
		printf("</td>");
		printf("<td align=\"center\">");
		print '<font color=\"#CC9900\" size=\"+5\"><strong>Price  </strong></font><font color=\"333333\" size=\"+5\"><strong>'.$row['hotelprice'].'$</strong></font>';
		printf("</td>");
		printf("</tr>");
		if ($i%2==0)
		{ printf("<tr bgcolor=\"CCFFFF\">\n");
		}
		else
		{
		printf("<tr>\n");	}
		printf("<td>");
		print '<a href="http://"'.$row['hotelwebsite'].'>'.$row['hotelwebsite'].'</a>';
		printf("</a>");
		printf("</td>");
		printf("<td>");
		printf("</td>");
		printf("</tr>");
		if ($i%2==0)
		{ printf("<tr bgcolor=\"CCFFFF\">\n");
		}
		else
		{
		printf("<tr>\n");	}
		printf("<td>");
		print '<font color=\"#006699\"><strong>'.$row['hoteladdress'].'</strong></font>';
		printf ("</td>");
		printf("<td>");
		printf("</td>");		
		printf("</tr>\n\n");
		$i++;
		printf("<tr height=\"10px\">");
		printf("<td>");
		printf("</td>");
		printf("</tr>\n\n");
}

?>
</table>
<?php 
$sql = "SELECT COUNT(hotelnameID) FROM hotel"; 
//print $sql;
$rs_result = mysql_query($sql); 
$row = mysql_fetch_row($rs_result); 
$total_records = $row[0]; 
$total_pages = ceil($total_records / 4); 
//print $total_pages;
for ($i=1; $i<=$total_pages; $i++) { 
			if ($i == $page) {
				print $i.' ';}
			else{
            print '<a style="color: #FF0000" href="hotel.php?page='.$i.'">'.$i.'</a> '; 
			}
};
mysql_close($link);
?>
	</div>
	<!-- end content -->
	<!-- start sidebar -->
	<div id="sidebar">
		<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','920','height','159','title','adv','src','images/adv','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/adv' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="920" height="159" title="adv">
          <param name="movie" value="images/adv.swf">
          <param name="quality" value="high">
          <embed src="images/adv.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="920" height="159"></embed>
	  </object></noscript>
	  <div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end sidebar -->
</div>
</div>

 
